
const Dictionary = (dataArr: any[]) => {
  let _dataArr: DictionaryArray = dataArr.map((item: any) => {
    return {
      label: item.dictionaryName,
      value: item.dictionaryValue || ''
    }
  })
  return _dataArr
}

const UserList = (dataArr: any[]) => {
  let _dataArr: DictionaryArray = dataArr.map((item: any) => {
    return {
      label: item.name,
      value: String(item.id) || ''
    }
  })
  return _dataArr
}

const ProjectList = (dataArr: any[]) => {
  let _dataArr: DictionaryArray = dataArr.map((item: any) => {
    return {
      label: item.projectName,
      value: String(item.id) || ''
    }
  })
  return _dataArr
}

const ModuleList = (dataArr: any[]) => {
  let _dataArr: DictionaryArray = dataArr.map((item: any) => {
    return {
      label: item.moduleName,
      value: String(item.id) || ''
    }
  })
  return _dataArr
}

const customizeDictionaryDB = {
  UserList: { module: 'organization', getData: UserList },
  ProjectList: { module: 'project', getData: ProjectList },
  ModuleList: { module: 'project', getData: ModuleList },
  Dictionary: { module: 'system', getData: Dictionary }
}

type CustomizeDictionaryValueType = 'UserList' | 'ProjectList' | 'ModuleList' | 'Dictionary'

export {
  customizeDictionaryDB,
}

export type { CustomizeDictionaryValueType }